package com.lcx.movie.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lcx.movie.entity.Stats;
import com.lcx.movie.mapper.StatsMapper;
import com.lcx.movie.service.StatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 李丽君
 * @version 1.0
 * @Description
 * @date 2025/3/19 10:03
 */
@Service
public class StatsServiceImpl extends ServiceImpl<StatsMapper, Stats> implements StatsService {

    @Autowired
    private StatsMapper statsMapper;

    /**
     * 查询数据信息
     * @return 数据实体
     */
    @Override
    public Stats getStats() {
        Stats stats = new Stats();
        stats.setBookmarks(statsMapper.getUserCount());
        stats.setLikes(statsMapper.getMovieCount());
        stats.setEvents(statsMapper.getCinemaCount());
        stats.setComments(statsMapper.getCommentCount());
        return stats;
    }
}
